<form class="layui-form" action="">
    <input name="erId" id="erId1" type="hidden" />

    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">角色名称:</label>
            <div class="layui-input-inline">
                <input type="text" name="erName" id="erName1" autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">角色备注:</label>
            <div class="layui-input-inline">
                <input type="text" name="erMark" id="erMark1" autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>

</form>

<script>
    $(function(){
        var data = $('#page-com').data('roleBar');
        //console.log(data);
        if (data != null){
            document.getElementById("erId1").value= data.id;
            document.getElementById("erName1").value= data.name;
            document.getElementById("erMark1").value= data.remark;

            $('#page-com').data('roleBar',null);
        }
    })

</script>